package com.cdel.akka.demo;

import com.cdel.akka.util.ActorCommand;

import akka.actor.UntypedActor;

public class ServerActor extends UntypedActor {

	@Override
	public void onReceive(Object message) throws Exception {
		if (message == ActorCommand.HeartBeat) {
			System.out.println(getSender().path().address().host().get() + " agent is start");
			getSender().tell(ActorCommand.HeartBeat_OK, getSelf());
		} else if (message == ActorCommand.DO_SOMETHING_OK) {
			System.out.println(getSender().path().address().host().get() + " do something ok!");
			getContext().stop(getSelf());
		}
	}

}
